package com.eascs.mq.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.eascs.admin.common.controller.BaseMasterViewController;
import com.eascs.app.dao.PageResult;
import com.eascs.mq.dao.MqDao;
import com.eascs.mq.form.MqQueryForm;
import com.eascs.site.page.PaginationInfo;
import com.eascs.site.page.SelectDataOption;
import com.eascs.site.view.ViewContext;

@Controller
@RequestMapping("/mq")
public class MqController extends BaseMasterViewController {

	@Autowired
	private MqDao mqDao;

	/**
	 * @param 查询合作方相关信息
	 * 
	 */
	@RequestMapping("/list")
	public String findPartnerInfo(MqQueryForm params) {
		params.setPageSize(10); // 每页数据量
		String o2ourl = "/mq/list?pageIndex=";
		PageResult<Object[]> pageResult = mqDao.findByPage(params.getPageIndex(), params.getPageSize());
		String[] titles = { "业务ID", "消息类型", "创建时间", "状态" };
		SelectDataOption[] selectDataOptions = { null, null, null, null };
		PaginationInfo paginationInfo = new PaginationInfo(pageResult, titles, o2ourl);
		paginationInfo.setBuildPagingNavigation(true);
		paginationInfo.setFirstRenderColumnIndex(1);
		paginationInfo.setBuildSelectBox(false);
		paginationInfo.setSelectDataOptions(selectDataOptions);
		ViewContext.put("paginationInfo", paginationInfo);
		return "mq/index";
	}
}
